<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title>网站信息</title>
    <link rel="stylesheet" href="/css/pintuer.css">
    <link rel="stylesheet" href="/css/admin.css">
    <script src="/js/jquery.js"></script>
    <script src="/js/pintuer.js"></script>
</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 用户列表</strong></div>
    <div class="padding border-bottom">
        <a class="button border-yellow" href="/user/add"><span class="icon-plus-square-o"></span> 添加用户</a>
    </div>
    <table class="table table-hover text-center">
        <tr>
            <th width="5%">ID</th>
            <th>用户姓名</th>
            <th>用户状态</th>
            <th width="250">操作</th>
        </tr>

        <tr th:each="user:${userList}">
            <td th:text="${user.id}"></td>
            <td th:text="${user.username}"></td>
            <td th:switch="${user.status}">
                <span th:case="0">未启用</span>
                <span th:case="1">启用</span>
            </td>
            <td>
                <div class="button-group">
                    <a type="button" class="button border-main" th:href="@{'/user/update/'+${user.id}}"><span
                            class="icon-edit"></span>修改</a>
                    <a class="button border-red" href="javascript:void(0)"
                       th:onclick="javascript:del([[${user.id}]])"><span
                            class="icon-trash-o"></span> 删除</a>
                </div>
            </td>
        </tr>
    </table>
</div>
<script>
    function del(id) {
        if (confirm("您确定要删除吗?")) {
            window.location.href = "/user/delete/" + id;
        }
    }
</script>
</body>
</html>